<template>
  <el-dialog
    title="审批日志"
    :visible.sync="visible"
    width="700px"
    :close-on-click-modal="false"
  >
    <el-table
      ref="table"
      :data="tableData"
      border
      stripe
      :height="300"
      :header-cell-style="{'background':'#F5F4F7'}"
    >
      <el-table-column
        type="index"
        label="序号"
        width="60"
        align="center"
      />
      <el-table-column
        prop="STROPERATORNAME"
        label="审批人"
        width="100"
      />
      <el-table-column
        prop="STRMESSAGE"
        label="审批信息"
        min-width="200"
      />
      <el-table-column
        prop="STRDATE"
        label="单据日期"
        min-width="180"
      />
      <el-table-column
        prop="STRTYPENAME"
        label="状态"
        width="80"
      />
    </el-table>

  </el-dialog>
</template>

<script>
import { getApprovalLogs } from '@/api/common/common'
import { mapGetters } from 'vuex'

export default {
  name: 'ApprovalLog',
  props: {
    typeId: {
      type: [String, Number],
      required: true
    },
    state: {
      type: [String, Number],
      required: true
    }

  },
  data() {
    return {
      visible: false,
      tableData: []
    }
  },
  computed: {
    ...mapGetters(['token'])
  },
  methods: {
    openDialog() {
      if (!this.state) {
        this.$message.error('还没有审批日志')
        return false
      }
      this.visible = true
      getApprovalLogs({
        'lngbusinessid': this.$route.query.id ? this.$route.query.id : 0,
        'lngoperatorid': '',
        'lngproductid': '315',
        'lngflowreceiptid': this.typeId,
        'strtaskid': ''
      }).then(res => {
        if (Array.isArray(res)) {
          this.tableData = res
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
